<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html>
<html>
    <jsp:include page="head.jsp"/>
    <body class="hold-transition skin-purple sidebar-mini">
        <div class="wrapper">
            <%-- 头部 --%>
            <jsp:include page="header.jsp"/>
            <%-- 头部 --%>
            <%-- 侧栏区域 --%>
            <jsp:include page="aside.jsp"/>
            <%-- 侧栏区域 --%>
            <!-- 内容区域 -->

            <div class="content-wrapper">
                <!-- 内容头部 -->
                <section class="content-header">
                    <h1>
                        数据管理
                        <small>数据列表</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                        <li><a href="#">数据管理</a></li>
                        <li class="active">数据列表</li>
                    </ol>
                </section>
                <!-- 内容头部 /-->
                <!-- 正文区域 -->
                <section class="content">

                    <!-- .box-body -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">列表</h3>
                        </div>

                        <div class="box-body">

                            <!-- 数据表格 -->
                            <div class="table-box">

                                <!--工具栏-->
                                <div class="pull-left">
                                    <div class="form-group form-inline">
                                        <div class="btn-group">
                                            <button type="button" class="btn btn-default" title="新建">
                                                <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-add"><i
                                                        class="fa fa-refresh"></i> 新建</a>
                                            </button>
                                            <button type="button" class="btn btn-default" title="刷新">
                                                <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list"><i
                                                        class="fa fa-refresh"></i> 刷新</a>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                                <div class="box-tools pull-right">
                                    <div class="has-feedback">
                                        <input type="text" class="form-control input-sm" placeholder="搜索">
                                        <span class="glyphicon glyphicon-search form-control-feedback"></span>
                                    </div>
                                </div>
                                <!--工具栏/-->

                                <!--数据列表-->
                                <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
                                    <thead>
                                        <tr>
                                            <th class="text-center">序号</th>
                                            <th class="text-center">管理员Id</th>
                                            <th class="text-center">姓名</th>
                                            <th class="text-center">权限</th>
                                            <th class="text-center">是否可用</th>
                                            <th class="text-center">创建时间</th>
                                            <th class="text-center">更新时间</th>
                                            <th class="text-center">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <c:forEach items="${jsonData.data.list}" var="u" varStatus="status">
                                            <tr>
                                                <td class="text-center">${status.index+1}</td>
                                                <td class="text-center">${u.adminId}</td>
                                                <td class="text-center">${u.adminUsername}</td>
                                                <td class="text-center">
                                                    <c:if test="${u.authority == 0}">
                                                        顶级管理员
                                                    </c:if>
                                                    <c:if test="${u.authority == 1}">
                                                        一级管理员
                                                    </c:if>
                                                    <c:if test="${u.authority == 2}">
                                                        二级管理员
                                                    </c:if>
                                                    <c:if test="${u.authority == 3}">
                                                        三级管理员
                                                    </c:if>
                                                </td>
                                                <td class="text-center">
                                                    <c:if test="${u.adminEnabled == 0}">
                                                        不可用
                                                    </c:if>
                                                    <c:if test="${u.adminEnabled == 1}">
                                                        可用
                                                    </c:if>
                                                </td>
                                                <td class="text-center">
                                                    <fmt:formatDate value="${u.createTime}" var="d1"
                                                                    pattern="yyyy.MM.dd"/> ${d1}
                                                </td>
                                                <td class="text-center">
                                                    <fmt:formatDate value="${u.updateTime}" var="d2"
                                                                    pattern="yyyy.MM.dd"/> ${d2}
                                                </td>
                                                <td class="text-center">
                                                    <a href="${pageContext.request.contextPath}/api/v1/pri/admin/edit?adminId=${u.adminId}&pageNum=${jsonData.data.pageNum}&pageSize=${jsonData.data.pageSize}"><button type="button" class="btn bg-olive btn-xs">编辑</button></a>
                                                </td>
                                            </tr>
                                        </c:forEach>
                                    </tbody>
                                </table>

                            </div>
                            <!-- 数据表格 /-->
                        </div>
                        <!-- /.box-body -->
                        <!-- .box-footer-->
                        <div class="box-footer">
                            <div class="pull-left">
                                <div class="form-group form-inline">
                                    总共 ${jsonData.data.pages} 页，共 ${jsonData.data.total} 条数据。 每页
                                    <select class="form-control" onchange="window.location=this.value;">
                                        <c:if test="${jsonData.data.pageSize == 6}">
                                            <option selected>
                                                6
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=12">
                                                12
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=18">
                                                18
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=24">
                                                24
                                            </option>
                                        </c:if>
                                        <c:if test="${jsonData.data.pageSize == 12}">
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=6">
                                                6
                                            </option>
                                            <option selected>
                                                12
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=18">
                                                18
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=24">
                                                24
                                            </option>
                                        </c:if>
                                        <c:if test="${jsonData.data.pageSize == 18}">
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=6">
                                                6
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=12">
                                                12
                                            </option>
                                            <option selected>
                                                18
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=24">
                                                24
                                            </option>
                                        </c:if>
                                        <c:if test="${jsonData.data.pageSize == 24}">
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=6">
                                                6
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=12">
                                                12
                                            </option>
                                            <option value="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=18">
                                                18
                                            </option>
                                            <option selected>
                                                24
                                            </option>
                                        </c:if>
                                    </select> 条 当前在第 ${jsonData.data.pageNum} 页
                                </div>
                            </div>

                            <div class="box-tools pull-right">
                                <ul class="pagination">
                                    <li>
                                        <c:if test="${jsonData.data.isFirstPage}">
                                            <a href="#" aria-label="Previous">首页</a>
                                        </c:if>
                                        <c:if test="${!jsonData.data.isFirstPage}">
                                            <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=1&pageSize=${jsonData.data.pageSize}"
                                               aria-label="Previous">首页</a>
                                        </c:if>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=${jsonData.data.prePage}&pageSize=${jsonData.data.pageSize}">
                                            上一页
                                        </a>
                                    </li>
                                    <c:forEach begin="1" end="${jsonData.data.pages}" varStatus="status">
                                        <li>
                                            <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=${status.index}&pageSize=${jsonData.data.pageSize}">${status.index}</a>
                                        </li>
                                    </c:forEach>
                                    <li>
                                        <c:if test="${jsonData.data.nextPage == 0}">
                                            <a href="#">下一页</a>
                                        </c:if>
                                        <c:if test="${jsonData.data.nextPage != 0}">
                                            <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=${jsonData.data.nextPage}&pageSize=${jsonData.data.pageSize}">
                                                下一页
                                            </a>
                                        </c:if>
                                    </li>
                                    <li>
                                        <c:if test="${jsonData.data.isLastPage}">
                                            <a href="#" aria-label="Previous">尾页</a>
                                        </c:if>
                                        <c:if test="${!jsonData.data.isLastPage}">
                                            <a href="${pageContext.request.contextPath}/api/v1/pri/admin/admin-list?pageNum=${jsonData.data.pages}&pageSize=${jsonData.data.pageSize}"
                                               aria-label="Previous">尾页</a>
                                        </c:if>
                                    </li>
                                </ul>
                            </div>

                        </div>
                        <!-- /.box-footer-->
                    </div>
                </section>
                <!-- 正文区域 /-->
            </div>
            <!-- 内容区域 /-->

            <!-- 底部导航 -->
            <jsp:include page="footer.jsp"/>
            <!-- 底部导航 /-->

        </div>
        <jsp:include page="footer-js.jsp"/>
    </body>

</html>
<!---->
